Introduction

If you shop like I do, you’ve just noticed this book on the shelf and picked it up to see what interesting topics it covers. You’ve read the table of contents. Aggressive. There is obviously a lot of detailed MFC information, but there is also a lot of ATL and COM information. Interesting.

So you turn to the introduction to see what it has to say about the wealth of information and hard-won experience contained in this (very large) volume. Will it convince you this book is the best MFC programming book on the market today?

Absolutely not. If by now you aren’t convinced that this is the best MFC programming book on the market, this introduction won’t sway you. However, this is the best MFC programming book on the market today. Why? Simply because the information contained within these pages represents decades of collective MFC programming experience—not the hobby-shop kind of programming, but rather the hard-core, schedule-pressure, “we need it now” kind of programming. From the basic to the intricate, every page contains more experience per page than any other MFC book out there today.

Programmers of all levels will benefit from the information you find here. You don’t understand the Document/View architecture? It’s explained here. You want to extend and go beyond the Document/View architecture? That’s here too, as well as all other aspects of MFC programming. In a nutshell, here is what you’ll find:

  MFC’s architecture and class layout
  MFC as C++
  MFC as a Windows application programming tool
  How to create compelling MFC applications
  Using Developer Studio to create more compelling MFC applications
  Using the Windows Common Controls from MFC applications
  Implementing your own custom controls using MFC
  MFC and the GDI
  All about MFC’s message routing scheme
  Documents and views, and how to supercharge their use
  MFC application user interface programming
  MFC and printing
  MFC as a COM server programming platform, including ActiveX programming
  MFC as a COM client programming platform
  Adding scripting to your MFC applications
  MFC and databases
  MFC’s utility classes, including exception processing
  MFC and the Web, including DHTML, WinInet, and ISAPI programming
  MFC and hot graphics programming using both OpenGL and DirectX
  How to add help access to your MFC applications

It is true that many of these topics can be found in some of the other books you see sitting on the shelf alongside this book. But none of them cover this much information in one place, and each topic here is covered in the deepest detail. After all, that is why the book is titled MFC Programming with Visual C++ 6 Unleashed.

How This Book Is Organized

This book is designed to be the most comprehensive MFC programming resource available anywhere today. As you work from chapter to chapter, you’ll not only learn what makes MFC tick, but you’ll also learn how to supercharge MFC, customize it, and take the architecture and make it work the way you want it to work. You’ll go way beyond the wizard-generated code and see how experienced MFC programmers do their magic. Soon, it’ll be your magic, too:

  Part I, “Core MFC,” covers the core MFC concepts. Here, you see how MFC was crafted to be a tremendous general-purpose application framework. When you understand the basic mechanics, you’ll see how to tailor MFC to better fit your programming requirements. Chapter 1 shows you the MFC architecture and introduces you to the major MFC classes you need to understand to get the most from the tool. Chapter 2 initiates your journey through MFC application development by showing you how MFC interacts with data and windows through the use of dialog boxes. Chapter 3 provides the details you need to get the most from the Windows common controls, especially the useful list and tree controls. Chapter 4 shows you how to manage GDI resources using MFC, as well as how you work with fonts, brushes, and so on. After you know how to deal with standard controls and paint screen items, you have what you need to tackle Chapter 5, which shows you how to create custom controls specific to your application. Finally, Chapter 6 dispels the myths surrounding MFC’s idle processing, allowing you to use seemingly idle application processing time to your advantage.
  Part II, “Documents, Views, and Applications That Use Them,” details the MFC architecture and how you can both optimize it and modify it to suit your personal needs. Chapter 7 describes the Document/View architecture. Chapter 8 shows you how to extend your application’s user interface. Finally, Chapter 9 blows the cover off using the printer from your MFC application, allowing you to move past the basic wizard-based code to really use the printer.
  Part III, “MFC and COM Programming,” describes MFC and COM programming, as most of today’s Windows applications use COM to provide at least some of their functionality. Chapter 10 introduces you to COM, and Chapter 11 provides an explanation of MFC’s implementation of COM. Chapters 12 and 13 discuss OLE servers and clients, and Chapter 14 shows you how to write feature-packed ActiveX controls that the containers you’ll develop in Chapter 15 can use to their advantage. Chapter 16 gives you the facts about mixing MFC and ATL, a templated COM framework. Chapter 17 shows you how to add scripting capabilities to your MFC applications.
  Part IV, “MFC Database Programming,” shows you how MFC and databases work together. Chapter 18 looks at MFC and various database programming concepts and technologies. Chapter 19 moves past the basics and shows you the current technologies in MFC (and COM) database processing.
  Part V, “MFC Utility Classes,” nails down the details regarding the MFC utility classes. Chapter 20 covers MFC string and collection management. Chapter 21 shows you how to work with files using MFC. Chapter 22 provides the critical details you need to process exceptional runtime conditions.
  Part VI, “MFC and the Web,” marries MFC and the Web. Chapter 23 introduces you to Dynamic HTML (DHTML) and how you can access DHTML from your MFC application. Chapter 24 shows you the basics of MFC network programming. Chapter 25 moves to advanced MFC network programming. Chapter 26 describes MFC ISAPI programming. Need to add telephonic or electronic mail support to your MFC application? Then Chapters 27 and 28 are here for you.
  Part VII, “MFC and Graphics Programming,” introduces you to the fascinating area of MFC graphics programming. Chapter 29 describes OpenGL and how you can exploit that technology in your MFC applications. Chapter 30 similarly describes MFC and DirectX. Chapter 31 goes a step further by adding full-fledged multimedia support to your MFC applications.
  Part VIII, “Advanced MFC,” gives you a wealth of insight born of experience. Chapter 32 shows you how to work with the Windows Registry database. Chapter 33 describes using MFC from within DLLs. And the final chapter, Chapter 34breaks open the secrets of Developer Studio AppWizard programming.

Who Should Read This Book?

Actually, this book is perfect for just about anyone interested in programming Windows applications using MFC. Whether you are just beginning or have weathered MFC programming from its inception, there are valuable nuggets for you here:

Beginners—The basic concepts are clearly and concisely covered. More important than that, however, is the valuable coverage you’ll find regarding pitfalls and potential optimizations. You’ll learn the basics, but you’ll also learn how to avoid common beginning MFC programmer mistakes.
Casual and accomplished MFC programmers—Use this book as a reference to delve into topics of specific interest. You will be able to reuse much of the code you find here to enhance your ongoing Windows programming tasks. You’ll also find detailed coverage of the latest Microsoft technologies with specific use from within MFC-based applications.
Experts—For you, this book provides the detailed programmer-to-programmer information you won’t find elsewhere. Our goal was to provide you with the deepest details and provide alternative methods of accomplishing intricate programming tasks. If you need it, it’s here for you.

We have worked exceptionally hard to provide you with the definitive work to date regarding MFC programming. Enjoy!